/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.manage.repository.service;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import info.peigen.hotpot.business.customer.core.domain.CustomerLog;
import info.peigen.hotpot.business.customer.core.repository.entity.CustomerLogEntity;
import info.peigen.hotpot.business.customer.manage.convertor.CustomerLogManageConvertor;
import info.peigen.hotpot.business.customer.manage.repository.mapper.CustomerLogManageMapper;
import info.peigen.hotpot.common.core.result.ResultCode;
import info.peigen.hotpot.common.service.base.exception.BusinessException;
import info.peigen.hotpot.component.data.repository.beetlsql.service.AbstractBeetlSqlRepository;
import org.noear.solon.annotation.Component;

/**
 * <b>(CustomerLogManageRepository)</b>
 * 管理后台 "客户登录日志" 仓储服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-09-08
 */
@SuppressWarnings("unused")
@Component
public class CustomerLogManageRepository extends AbstractBeetlSqlRepository<CustomerLogManageMapper, CustomerLogEntity> {
    public void store(CustomerLog domain) {
        Assert.isTrue(ObjectUtil.isNotEmpty(domain), () -> new BusinessException(ResultCode.FAILURE, "持久化时[domain]不得为空!"));

        CustomerLogEntity entity = CustomerLogManageConvertor.convertToEntity(domain);

        saveOrUpdate(entity);
    }
}